package org.rendao.init
{
	import com.googlecode.flexxb.FlexXBEngine;
	
	import mx.collections.ArrayCollection;
	import mx.core.FlexGlobals;
	
	import org.rendao.flexxb.converter.CommonDateConverter;
	import org.rendao.service.UserService;
	import org.rendao.service.base.GlobalModule;
	
	import spark.components.Application;

	public class InitialHandler
	{
		public function InitialHandler()
		{
			FlexXBEngine.instance.registerSimpleTypeConverter(new CommonDateConverter(), true);
			getHostUrl();
		}
		
		private function getHostUrl():void {
			var app:Application = FlexGlobals.topLevelApplication as Application;
			var url:String = app.url;
			var index:int = url.lastIndexOf("/");
			var hostUrl:String = url.substring(0, index);
			trace(hostUrl);
			GlobalModule.hostUrl = hostUrl; 
		}
	}
}